<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use App\Models\User;

class UserAddressRequest extends FormRequest
{
    public $user_id;

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        $user_id = User::where('remember_token',$this->token)->value('id');
        if($user_id) {
            $this->user_id = $user_id;
            return true;
        }        
        return false;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [];
    }

    public function messages()
    {
       return [];
    }

    public function pure()
    {
        return  array_except($this->all(), ['_token','_method']);
    }
}
